package com.example.courseselectionsystemconsume.controller;

import com.example.courseselectionsystemconsume.pojo.User;
import com.example.courseselectionsystemconsume.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: TODO
 * @author: Tokyo_God
 * @date: 2020/12/28 16:18
 * Role of:
 * @version: v1.0
 */
@RestController
public class UserController {

    @Autowired
    private UserServiceImpl userService;

    /**
     * 激活用户
     * @return
     */
    @GetMapping("/activateUser/{name}")
    @ResponseBody
    public String activateUser(@PathVariable("name")String name){
        User user =new User();
        user.setName(name);
        user.setActivate(1);
        System.out.println(name);
        Integer num=userService.upUser(user);
        if(num<0){
            return "激活失败";
        }else{
            return "激活成功";
        }
    }
}
